unit libslsql;

interface

////////////////////////////////////////////////////////////////////////////////
{ Wrappers for sl* functions if they calls SQLitening.Dll directly.}
////////////////////////////////////////////////////////////////////////////////

procedure sluClose();
function  sluGetColumnCount(SetNumber: Integer): Integer;
procedure sluDisconnect();

////////////////////////////////////////////////////////////////////////////////
{ External slu* functions }
////////////////////////////////////////////////////////////////////////////////

procedure sluGetError(Error: PChar; var SizeOfError: Integer);
  stdcall; external 'libslsql.dll';
//'===========================<[ Get Error ]>============================
//Declare Sub      sluGetError lib "libslsql.dll" alias "sluGetError" ( _
//                                 byval Error as Long, _
//                                 byref SizeOfError as Long)
//'   Error is a pointer to the memory which will receive the field value.
//'              A Null (hex '00') will be added to end.
//'   SizeOfError is both passed and returned. Pass the size of Error.
//'               It must be at least the size of the returning error + 1.
//'               The actual length of the returing error is returned.
//'               If the passed size is too small then error -13 will be raised
//'               and the returning length will be set to -1.

function sluConnect(Server: PChar; Port: Integer; ModChars: PChar; OutData: PChar; var SizeOfOutData: Integer): Integer;
  stdcall; external 'libslsql.dll';
//'============================<[ Connect ]>=============================
//Declare Function sluConnect lib "libslsql.dll" alias "sluConnect" (_
//                                 byval Server as Long, _
//                                 ByVal Port As Long, _
//                                 byval ModChars as Long, _
//                                 byval OutData as Long, _
//                                 byref SizeOfOutData as Long) as Long
//'   Server is a pointer to a null-terminated string.
//'   ModChars is a pointer to a null-terminated string. If not needed you
//'            may pass a zero.
//'   DataOut is a pointer to the returning out data. If not needed you
//'           may pass a zero.
//'   SizeOfOutData is both passed and returned. Pass the size of OutData.
//'                 It must be at least the size of the returning out data.
//'                 The actual length of the returing out data is returned.
//'                 If the passed size is too small then the returning length will
//'                 be set to -1.

function sluOpen(FileName: PChar; ModChars: PChar): Integer;
  stdcall; external 'libslsql.dll';
//'==============================<[ Open ]>==============================
//Declare Function sluOpen lib "libslsql.dll" alias "sluOpen" ( _
//                                 byval FileName as Long, _
//                                 byval ModChars as Long) as Long
//'   FileName is a pointer to a null-terminated string. If not needed you
//'            may pass a zero.
//'   ModChars is a pointer to a null-terminated string. If not needed you
//'            may pass a zero.

function sluSel(Statement: PChar; SetNumber: Integer; ModChars: PChar): Integer;
  stdcall; external 'libslsql.dll';
//'==============================<[ Sel ]>===============================
//Declare Function sluSel lib "libslsql.dll" alias "sluSel" ( _
//                                 byval Statement as Long, _
//                                 byval SetNumber as Long, _
//                                 byval ModChars as Long) as Long
//'   Statement is a pointer to a null-terminated string.
//'   ModChars is a pointer to a null-terminated string. If not needed you
//'            may pass a zero.

function sluGetRow(SetNumber: Integer; AModChars: PChar): Integer;
  stdcall; external 'libslsql.dll';
//'============================<[ Get Row ]>=============================
//Declare Function sluGetRow lib "libslsql.dll" alias "sluGetRow" ( _
//                                 byval SetNumber as Long, _
//                                 byval ModChars as Long) as Long
//'   ModChars is a pointer to a null-terminated string. If not needed you
//'            may pass a zero.

procedure sluF(ColumnNumber: Integer; FieldValue: PChar; var SizeOfFieldValue: Integer; SetNumber: Integer);
  stdcall; external 'libslsql.dll';
//'===========================<[ Field Get ]>============================
//Declare Sub      sluF Lib "libslsql.dll" Alias "sluF" ( _
//                                 byval ColumnNumber as Long, _
//                                 byval FieldValue as Long, _
//                                 byref SizeOfFieldValue as Long, _
//                                 byval SetNumber as Long)
//
//'   FieldValue is a pointer to the memory which will receive the field value.
//'              A Null (hex '00') will be added to end.
//'   SizeOfFieldValue is both passed and returned. Pass the size of FieldValue.
//'                    It must be at least the size of the returning field value + 1.
//'                    The actual length of the returing field value is returned.
//'                    If the passed size is too small then error -13 will be raised
//'                    and the returning length will be set to -1.

procedure sluFX(ColumnNumber: Integer; FieldValue: PChar; var SizeOfFieldValue: Integer; SetNumber: Integer; ModChars: PChar);
  stdcall; external 'libslsql.dll';
//'=======================<[ Field Get Extended ]>=======================
//Declare Sub      sluFX lib "libslsql.dll" alias "sluFX" ( _
//                                 byval ColumnNumber as Long, _
//                                 byval FieldValue as Long, _
//                                 byref SizeOfFieldValue as Long, _
//                                 byval SetNumber as Long, _
//                                 byval ModChars as Long)
//'   FieldValue is a pointer to the memory which will receive the field value.
//'              A Null (hex '00') will be added to end (meaningless for a field
//'              containing binary data).
//'   SizeOfFieldValue is both passed and returned. Pass the size of FieldValue.
//'                    It must be at least the size of the returning field value + 1.
//'                    The actual length of the returing field value is returned.
//'                    If the passed size is too small then error -13 will be raised
//'                    and the returning length will be set to -1.
//'   ModChars is a pointer to a null-terminated string. If not needed you
//'            may pass a zero.

procedure sluFN(ColumnName: PChar; FieldValue: PChar; var SizeOfFieldValue: Integer; SetNumber: Integer);
  stdcall; external 'libslsql.dll';
//'=========================<[ Field Name Get ]>=========================
//Declare Sub      sluFN Lib "libslsql.dll" Alias "sluFN" ( _
//                                 byval ColumnName as Long, _
//                                 byval FieldValue as Long, _
//                                 byref SizeOfFieldValue as Long, _
//                                 byval SetNumber as Long)
//'   ColumnName is a pointer to a null-terminated string.
//'   FieldValue is a pointer to the memory which will receive the field value.
//'              A Null (hex '00') will be added to end.
//'   SizeOfFieldValue is both passed and returned. Pass the size of FieldValue.
//'                    It must be at least the size of the returning field value + 1.
//'                    The actual length of the returing field value is returned.
//'                    If the passed size is too small then error -13 will be raised
//'                    and the returning length will be set to -1.

procedure sluFNX(ColumnName: PChar; FieldValue: PChar; var SizeOfFieldValue: Integer; SetNumber: Integer; ModChars: PChar);
  stdcall; external 'libslsql.dll';
//'====================<[ Field Name Get Extended ]>=====================
//Declare Sub      sluFNX lib "libslsql.dll" alias "sluFNX" ( _
//                                 byval ColumnName as Long, _
//                                 byval FieldValue as Long, _
//                                 byref SizeOfFieldValue as Long, _
//                                 byval SetNumber as Long, _
//                                 byval ModChars as Long)
//'   ColumnName is a pointer to a null-terminated string.
//'   FieldValue is a pointer to the memory which will receive the field value.
//'              A Null (hex '00') will be added to end (meaningless for a field
//'              containing binary data).
//'   SizeOfFieldValue is both passed and returned. Pass the size of FieldValue.
//'                    It must be at least the size of the returning field value + 1.
//'                    The actual length of the returing field value is returned.
//'                    If the passed size is too small then error -13 will be raised
//'                    and the returning length will be set to -1.
//'   ModChars is a pointer to a null-terminated string. If not needed you
//'            may pass a zero.

procedure sluGetColumnName(ColumnNumber: Integer; ColumnName: PChar; var SizeOfColumnName: Integer; SetNumber: Integer);
  stdcall; external 'libslsql.dll';
//'========================<[ Get Column Name ]>=========================
//Declare Sub      sluGetColumnName lib "libslsql.dll" alias "sluGetColumnName" ( _
//                                 byval ColumnNumber as Long, _
//                                 byval ColumnName as Long, _
//                                 byref SizeOfColumnName as Long, _
//                                 byval SetNumber as Long)
//'   ColumnName is a pointer to the memory which will receive the column
//'              name(s).  Will return all column names if the passed column
//'              number is zero. If all column names are returned then it is
//'              a delimited text string which is $NUL seperated.  A Null
//'              (hex '00') will be added to end (meaningless if all column
//'              names are returned).
//'   SizeOfColumnName is both passed and returned. Pass the size of ColumnName.
//'                    It must be at least the size of the returning column name + 1.
//'                    The actual length of the returing column name(s) is returned.
//'                    If the passed size is too small then error -13 will be raised
//'                    and the returning length will be set to -1.



implementation

////////////////////////////////////////////////////////////////////////////////
{ External sl* functions for calls SQLitening.Dll directly.}
////////////////////////////////////////////////////////////////////////////////

procedure slClose();
  stdcall; external 'libslsql.dll';
//'=============================<[ Close ]>==============================
//Declare Sub      sluClose lib "libslsql.dll" alias "slClose"
//'   Calls SQLitening.Dll directly.

function slGetColumnCount(SetNumber: Integer): Integer;
  stdcall; external 'libslsql.dll';
//'========================<[ Get Column Count ]>========================
//Declare Function sluGetColumnCount lib "libslsql.dll" alias "slGetColumnCount" ( _
//                                 byval SetNumber as Long) as Long
//'   Calls SQLitening.Dll directly.

procedure slDisconnect();
  stdcall; external 'libslsql.dll';
//'===========================<[ Disconnect ]>===========================
//Declare Sub      sluDisconnect lib "libslsql.dll" alias "slDisconnect"
//'   Calls SQLitening.Dll directly.

procedure sluClose();
begin
  slClose();
end;

function sluGetColumnCount(SetNumber: Integer): Integer;
begin
  Result := slGetColumnCount(SetNumber);
end;

procedure sluDisconnect();
begin
  slDisconnect();
end;

end.
